home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_asm / objxref / xrsrch.asm < prev    next >
Encoding:
Assembly Source File  |  1986-04-26  |  1.9 KB  |  81 lines

  1.  PAGE    81,128
  2.  TITLE    XRSRCH    - Search externals for input name.
  3.  SUBTTL    V1.0 - May 1986    - Cross    Reference Facility
  4. ;
  5. ;=============================================================================|
  6. ;         Copyright 1986 - Dan Daetwyler - Springdale, AR 72764          |
  7. ;=============================================================================|
  8.     .SALL
  9. ;
  10. DATA    SEGMENT    BYTE PUBLIC 'DATA'
  11. ;
  12.     EXTRN    MEXTN:BYTE,MECNT:WORD
  13. ;
  14. DATA    ENDS
  15. ;
  16. CODE    SEGMENT    BYTE PUBLIC 'CODE'
  17.     ASSUME    CS:CODE,DS:DATA,ES:DATA
  18. ;
  19. ;==============================================================================
  20. ; Entry    Point    XRSRCH                                  |
  21. ;==============================================================================
  22. ;                                          |
  23. ; This procedure searches the EXTRN  names stack for a match against the      |
  24. ; input    name.  If it finds a match, it returns the pointer associated with    |
  25. ; the modulename in the    BX register.  If it does not, it returns with carry   |
  26. ; set.                                          |
  27. ;                                          |
  28. ; Entry    conventions:    DS:SI points to    a search name (length byte prefix).   |
  29. ;            DS:DI points to    current    poisition in external stack   |
  30. ;                                          |
  31. ; Returns:        Match:    no carry, BX points to module name          |
  32. ;            Not found: carry set.                      |
  33. ;                                          |
  34. ;==============================================================================
  35. ;
  36.     EXTRN
  37. ;
  38.     PUBLIC    XRSRCH
  39. ;
  40. XRSRCH    PROC    NEAR
  41.     PUSH    DX
  42.     PUSH    CX
  43.     MOV    AX,DI            ;Find poisition    in stack
  44.     SUB    AX,OFFSET MEXTN
  45.     MOV    CX,15
  46.     XOR    DX,DX
  47.     DIV    CX            ;Compute count of entries searched
  48.     MOV    CX,MECNT
  49.     SUB    CX,AX            ;CX contains number of names remaining
  50.     JCXZ    FAIL
  51. SLP:    CALL    COMP
  52.     JE    HIT
  53.     ADD    DI,15
  54.     LOOP    SLP
  55. FAIL:    STC
  56.     POP    CX
  57.     POP    DX
  58.     RET
  59. HIT:    MOV    BX,WORD    PTR [DI+13]
  60.     POP    CX
  61.     POP    DX
  62.     CLC
  63.     RET
  64. XRSRCH    ENDP
  65. ;
  66. COMP    PROC    NEAR
  67.     PUSH    DI
  68.     PUSH    SI
  69.     PUSH    CX
  70.     MOV    CX,13
  71.     REPE    CMPSB
  72.     POP    CX
  73.     POP    SI
  74.     POP    DI
  75.     RET
  76. COMP    ENDP
  77. ;
  78. CODE    ENDS
  79. ;
  80.     END
  81.